gpx: Write track extensions before tag 'trkseg' (published in german c't 2008/19...
authoroliskoli <oliskoli>
Wed, 17 Sep 2008 22:33:56 +0000 (22:33 +0000)
committeroliskoli <oliskoli>
Wed, 17 Sep 2008 22:33:56 +0000 (22:33 +0000)
write track/route extensions only if gpx version 1.1 was specified.

gpx.c

diff --git a/gpx.c b/gpx.c
index 6363d9e11d3343970e9d608b13c074417c207fc8..cef110ffbd141281089052e63f32dc117bc25568 100644 (file)
--- a/gpx.c
+++ b/gpx.c
@@ -1676,12 +1676,15 @@ gpx_track_hdr(const route_head *rte)
        if (rte->rte_num) {
                gbfprintf(ofd, "<number>%d</number>\n", rte->rte_num);
        }
-       gbfprintf(ofd, "<trkseg>\n");
-
-       fs_gpx = (fs_xml *)fs_chain_find( rte->fs, FS_GPX );
-       if ( fs_gpx ) {
-               fprint_xml_chain( fs_gpx->tag, NULL );
+       
+       if (gpx_wversion_num > 10) {
+               fs_gpx = (fs_xml *)fs_chain_find( rte->fs, FS_GPX );
+               if ( fs_gpx ) {
+                       fprint_xml_chain( fs_gpx->tag, NULL );
+               }
        }
+
+       gbfprintf(ofd, "<trkseg>\n");
 }
 
 static void
@@ -1749,9 +1752,11 @@ gpx_route_hdr(const route_head *rte)
                gbfprintf(ofd, "  <number>%d</number>\n", rte->rte_num);
        }
 
-       fs_gpx = (fs_xml *)fs_chain_find( rte->fs, FS_GPX );
-       if ( fs_gpx ) {
-               fprint_xml_chain( fs_gpx->tag, NULL );
+       if (gpx_wversion_num > 10) {
+               fs_gpx = (fs_xml *)fs_chain_find( rte->fs, FS_GPX );
+               if ( fs_gpx ) {
+                       fprint_xml_chain( fs_gpx->tag, NULL );
+               }
        }
 }